﻿Public Class Form1

    Dim x As New Random
    Dim f As New Stack
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        zufall()
        For ix As Integer = 1 To 100
            f.Push(st)
        Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        zufall()
    End Sub
    Private Sub zufall()
        Dim y As String = x.Next(1, 5).ToString
        Dim looop As Boolean = True
        Select Case y
            Case Is = "1"
                Label3.Text = "Steve"
            Case Is = "2"
                Label3.Text = "Breiti"
            Case Is = "3"
                Label3.Text = "Franz"
            Case Is = "4"
                Label3.Text = "Rene"
            Case Is = "5"
                Label3.Text = "Keiner"
        End Select
        Dim z As String = x.Next(1, 5).ToString
        Do While looop = True
            z = x.Next(1, 5).ToString
            If y = z Then
                looop = True
            Else
                looop = False
            End If
        Loop
        Select Case z
            Case Is = "1"
                Label4.Text = "Steve"
            Case Is = "2"
                Label4.Text = "Breiti"
            Case Is = "3"
                Label4.Text = "Franz"
            Case Is = "4"
                Label4.Text = "Rene"
            Case Is = "5"
                Label4.Text = "Keiner"
        End Select
    End Sub
    Private Function st()
        Dim y As String = x.Next(1, 5).ToString
        Select Case y
            Case Is = "1"
                Return "Steve"
            Case Is = "2"
                Return "Breiti"
            Case Is = "3"
                Return "Franz"
            Case Is = "4"
                Return "Rene"
            Case Else
                Return "Keiner"
        End Select
    End Function

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If f.Count < 1 Then
            For ix As Integer = 1 To 100
                f.Push(st)
            Next
        End If
        MsgBox(f.Pop)
    End Sub
End Class
